package com.bocai.eelly.common;

import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.TextView;

import com.bocai.eelly.R;


/**
 * Created by kaizen on 16/1/9.
 */
public class ToolbarHelper {

    public static Toolbar setup(AppCompatActivity activity, int title, int resId, View.OnClickListener onClickListener) {
        Toolbar toolbar = (Toolbar) activity.findViewById(R.id.toolbar);
        TextView textView = (TextView) activity.findViewById(R.id.tv_title);
        textView.setText(title);
//        activity.setSupportActionBar(toolbar);
        toolbar.setNavigationIcon(resId);
        toolbar.setNavigationOnClickListener(onClickListener);
        return toolbar;
    }

    public static void setup(AppCompatActivity activity, int title) {
        Toolbar toolbar = (Toolbar) activity.findViewById(R.id.toolbar);
        TextView textView = (TextView) activity.findViewById(R.id.tv_title);
        textView.setText(title);
        activity.setSupportActionBar(toolbar);
    }

}
